package com.mhh.selary.backend.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 用户账号状态(1:启用 2:禁用)
 *
 * @author mhh
 * @date 2020-11-11 16:57:01
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum {

    /**
     *
     */
    INIT(0, "待激活"),

    ENABLE(1, "启用"),

    DISABLE(2, "禁用"),
    ;

    private Integer status;

    private String desc;

    public static boolean isForbidden(Integer status) {
        return DISABLE.getStatus().equals(status);
    }

    public static UserStatusEnum valueBy(Integer status) {
        return Arrays.stream(UserStatusEnum.values()).filter(enumItem -> enumItem.getStatus().equals(status)).findFirst().orElse(null);
    }
}
